package com.cloud.alibaba.rpc.feign;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @author 刘志强
 * @date 2020/11/17 15:23
 * producer-example 生产者服务的 spring.application.name
 * fallback 当下游服务异常时，本服务的回滚处理类
 */
@FeignClient(value = "producer-example", fallback = FeignServiceImpl.class)
public interface FeignService {

    /**
     * 获取用户名
     * @param authorization
     * @param userName
     * @return
     */
    @RequestMapping(method = RequestMethod.GET, value = "/getUserName")
    String getUserName(@RequestHeader(value = "Authorization") String authorization, @RequestParam("userName") String userName);

}
